#ifndef __PLAYER
#define __PLAYER

#include "libraries.h"
#include "object.h"

class Ammo; /* Forward declaration of class Ammo */

class Player : public Object
{
    private:
        int lives;
        int maxAmmo;       /* Higher numbers = more ammo */
        double ammoDelay;     /* Lower numbers = faster rate of fire */
        int ammoVelocity;  /* Higher numbers = faster projectile velocity */
        int movementSpeed; /* Higher numbers = faster player movement */
        int ammoType;      /* Keeps track of upgrades, etc. */
        bool isDead; /* If player is dead, this is true */
        int points;
        double ammoCooldown; /* Keeps track of the delay on ammo */
        string name;

    public:
        list<Ammo> ammunition;
        Player(Sint16 coordX, Sint16 coordY, string imageLocation = "Images/Ship/shipCenterNew2.png");
        Player();
        Player(const Player &);
        ~Player();
        const Player& operator= (const Player&);
        int getMovementSpeed(){return movementSpeed;}
        Uint32 getPoints(){    return points;}
        int getLives(){return lives;}
        void setMovementSpeed(int speed){movementSpeed = speed;}
        void setPoints(Uint32 score){            points = score;}
        void move(Uint8*); /* Takes in keyinput to detect movement */
        void setIsDead(bool d){isDead = d;}
        bool getIsDead(){return isDead;}
        void setLives(int l){lives = l;}
        void setMaxAmmo(int m){maxAmmo = m;}
        list<Ammo>& getAmmoList(){return ammunition;}
};

class Ammo : public Object
{
    private:
        int idNumber;   /* Type of ammo */
    public:
        Ammo();
        Ammo(Player&, int ammoType=0);
        ~Ammo();
        void move(int); /* Movement is based off of idNumber, so no input needed */
        Ammo(const Ammo&);
        const Ammo& operator= (const Ammo&);
        int getIdNumber(){return idNumber;}
        void setIdNumber(int id){idNumber = id;}
};

/* Enemy contains all enemies EXCEPT FOR the centipede */
class Enemy : public Object
{
    private:
        int idNumber;
        int health;
        int healthMax;
        int value;
        int ammoCooldown;
        int damage;
        int selfDamage;
        int offset;
    public:
        list<SDL_Rect> movementMemory;
        Enemy(int idNum=0, int hp=0, int val=0, string model="",
              int ammoCool=0, int dmg=0, int modelRotation=0, int selfDmg=0,
              bool changeDifficulty=true);
        Enemy(const Enemy&);
        const Enemy& operator= (const Enemy&);
        ~Enemy();
        int move(list<Enemy>& enemy,int index, Uint32 frame); /* Returns change in index if needed */
        int getHealth(){return health;}
        int getValue() {return value;}
        int getIdNumber(){return idNumber;}
        int getSelfDamage(){return selfDamage;}
        void setIdNumber(int id){idNumber = id;}
        void setHealth(int hp){ health = hp;}
        void setValue(int val){ value  = val;}
        void setSelfDamage(int s){selfDamage = s;}
        void setAmmoCooldown(int a){ammoCooldown = a;}
};

class Centi //Not the scientific unit prefix
{
    private:
        double movementSpeed;
        bool moveLeft, moveDown; //Move to the left and down
    public:
        list<Enemy> centipedeParts;
        Centi();
        Centi(int, SDL_Rect&);
        //Centi(Centi&);
        //~Centi();
        const Centi& operator= (Centi&);
        void move(list<Enemy>&); //Move through all of list
        void collision(list<Centi>& centipedes, int); //Collision on centipedePart of index i
        bool mushroomCollide(list<Enemy>& enemyList, const SDL_Rect&); //Checks for collision with mushrooms
        list<Enemy>& getCentipedeParts(){ return centipedeParts;}
};

void makeEnemy(list<Enemy>& enemy, string enemyName);
void createEnemies(list<Enemy>& enemy, string enemyName, int countAmount);
void createEnemiesQueue(Uint32 curTime, list<Enemy>& enemy, string enemyName, int countAmount, int cooldownTime, int number=1);
#endif
